﻿
Imports idsysctx
Imports occommon
Imports occommon.getResponse

Public MustInherit Class [get]
    Inherits oper

    Protected MustOverride Function responseContent(ByVal site As String, _
                                                    ByVal user As String, _
                                                    ByRef content As String) As Boolean

    Protected Shared Function writeContent(ByRef content As String, _
                                           ByVal name As String, ByVal value As String) As Boolean
        assert(Not isemptystring(name))
        If Not isemptystring(value) Then
            content += name + contentNameValueSeparator + value + contentSeparator
        End If
        Return True
    End Function

    Protected NotOverridable Overrides Function process(ByVal site As String, _
                                                        ByVal user As String, _
                                                        ByVal context As httpContext) As Boolean
        Dim content As String = Nothing
        If responseContent(site, user, content) Then
            context.writer().WriteLine(content)
            Return setSuccessStatus(context)
        Else
            Return context.setstatuscode(statusCode.noCookiesFound, description.noCookiesFound)
        End If
    End Function
End Class
